From 184f64034de7f553ee2610d6a559e61c619af960 Mon Sep 17 00:00:00 2001 From: Michael Dale Date: Wed, 11 Nov 2009 14:45:55 +0000 Subject: [PATCH] * editpage add-media-wizard binding fix * fixed remoteMw embed calls * stubs for k-player fallback * fixed native seek for videos that have not started playing yet * some timedText fixes --- js2/editPage.js | 11 +- .../example_usage/Player_Themable.html | 2 +- js2/mwEmbed/libEmbedVideo/embedVideo.js | 202 +++++++++++------- .../{flashEmbed.js => flowplayerEmbed.js} | 17 +- js2/mwEmbed/libEmbedVideo/kplayerEmbed.js | 74 +++++++ js2/mwEmbed/libEmbedVideo/nativeEmbed.js | 28 ++- .../libSequencer/mvTimedEffectsEdit.js | 7 +- js2/mwEmbed/libTimedText/mvTextInterface.js | 59 ++--- js2/mwEmbed/libTimedText/mvTimeTextEdit.js | 29 +-- js2/mwEmbed/mv_embed.js | 45 ++-- js2/mwEmbed/php/languages/mwEmbed.i18n.php | 24 ++- js2/mwEmbed/skins/ctrlBuilder.js | 2 +- js2/remoteMwEmbed.js | 56 ++--- 13 files changed, 360 insertions(+), 196 deletions(-) rename js2/mwEmbed/libEmbedVideo/{flashEmbed.js => flowplayerEmbed.js} (99%) create mode 100644 js2/mwEmbed/libEmbedVideo/kplayerEmbed.js diff --git a/js2/editPage.js b/js2/editPage.js index c03bf063e6..0e93231d2f 100644 --- a/js2/editPage.js +++ b/js2/editPage.js @@ -21,6 +21,7 @@ var defaultAddMediaConfig = { }; js2AddOnloadHook( function() { + js_log("edit page js2AddOnloadHook::"); var amwConf = $j.extend( true, defaultAddMediaConfig, mwAddMediaConfig ); // kind of tricky, it would be nice to use run on ready "loader" call here var didWikiEditorBind = false; @@ -49,17 +50,19 @@ js2AddOnloadHook( function() { //Add to old toolbar if wikiEditor did not remove '#toolbar' from the page: setTimeout(function(){ if( $j('#btn-add-media-wiz').length == 0 && $j( '#toolbar' ).length != 0 ){ - js_log(' old toolbar bind:'); + js_log( 'Do old toolbar bind:' ); + didWikiEditorBind = true; $j( '#toolbar' ).append( '' ); $j( '#btn-add-media-wiz' ).addMediaWiz( amwConf ); - }else{ - js_log('failed to bind via build section bind via target:'); + }else{ //Make sure the wikieditor got binded: - if( !didWikiEditorBind ) + if( !didWikiEditorBind ){ + js_log( 'Failed to bind via build section bind via target:' ); $j(".tool[rel='file']").unbind().addMediaWiz( amwConf ); + } } }, 120) diff --git a/js2/mwEmbed/example_usage/Player_Themable.html b/js2/mwEmbed/example_usage/Player_Themable.html index a32e539ef6..a17f857a13 100644 --- a/js2/mwEmbed/example_usage/Player_Themable.html +++ b/js2/mwEmbed/example_usage/Player_Themable.html @@ -26,7 +26,7 @@ src="http://upload.wikimedia.org/wikipedia/commons/2/29/Charles_Lindbergh_flight poster="http://upload.wikimedia.org/wikipedia/commons/thumb/2/29/Charles_Lindbergh_flight_to_Brussels.ogg/mid-Charles_Lindbergh_flight_to_Brussels.ogg.jpg" durationHint="15"> -(ksin) Source Code used:
+(kskin) Source Code used:
diff --git a/js2/mwEmbed/libEmbedVideo/embedVideo.js b/js2/mwEmbed/libEmbedVideo/embedVideo.js index 8bdefe3b7f..00cef43e44 100644 --- a/js2/mwEmbed/libEmbedVideo/embedVideo.js +++ b/js2/mwEmbed/libEmbedVideo/embedVideo.js @@ -34,9 +34,8 @@ loadGM({ "mwe-video_credits" : "Video credits", "mwe-menu_btn" : "Menu", "mwe-close_btn" : "Close", - "mwe-ogg-player-vlc-mozilla" : "VLC plugin", + "mwe-ogg-player-vlc-player" : "VLC player", "mwe-ogg-player-videoElement" : "Native Ogg video", - "mwe-ogg-player-vlc-activex" : "VLC ActiveX", "mwe-ogg-player-oggPlugin" : "Generic Ogg plugin", "mwe-ogg-player-quicktime-mozilla" : "QuickTime plugin", "mwe-ogg-player-quicktime-activex" : "QuickTime ActiveX", @@ -59,45 +58,45 @@ loadGM({ var commons_api_url = 'http://commons.wikimedia.org/w/api.php'; var default_video_attributes = { - "id":null, - "class":null, - "style":null, - "name":null, - "innerHTML":null, - "width":"320", - "height":"240", + "id" : null, + "class" : null, + "style" : null, + "name" : null, + "innerHTML" : null, + "width" : "320", + "height" : "240", //video attributes: - "src":null, - "autoplay":false, - "start":0, - "end":null, - "controls":true, - "muted":false, - "wikiTitleKey":null, + "src" : null, + "autoplay" : false, + "start" : 0, + "end" : null, + "controls" : true, + "muted" : false, + "wikiTitleKey" : null, //roe url (for xml based metadata) - "roe":null, + "roe" : null, //if roe includes metadata tracks we can expose a link to metadata - "show_meta_link":true, + "show_meta_link" : true, //default state attributes per html5 spec: //http://www.whatwg.org/specs/web-apps/current-work/#video) - "paused":true, - "readyState":0, //http://www.whatwg.org/specs/web-apps/current-work/#readystate - "currentTime":0, //current playback position (should be updated by plugin) - "duration":null, //media duration (read from file or the temporal url) - "networkState":0, + "paused" : true, + "readyState" : 0, //http://www.whatwg.org/specs/web-apps/current-work/#readystate + "currentTime" :0, //current playback position (should be updated by plugin) + "duration" :null, //media duration (read from file or the temporal url) + "networkState" : 0, - "startOffset":null, //if serving an ogg_chop segment use this to offset the presentation time + "startOffset" : null, //if serving an ogg_chop segment use this to offset the presentation time //custom attributes for mv_embed: - "play_button":true, - "thumbnail":null, - "linkback":null, - "embed_link":true, - "download_link":true, - "type":null, //the content type of the media + "play_button" : true, + "thumbnail" : null, + "linkback" : null, + "embed_link" : true, + "download_link" : true, + "type" :null, //the content type of the media }; /* * the base source attribute checks @@ -109,10 +108,12 @@ var mv_default_source_attr= new Array( 'titleKey', 'title', 'URLTimeEncoding', //boolean if we support temporal url requests on the source media - 'startOffset', + 'startOffset', + 'durationHint', 'start', - 'end', + 'end', + 'default', 'lang' ); @@ -335,10 +336,7 @@ mediaSource.prototype = if( $j(element).attr( attr ) ) { this[ attr ] = $j(element).attr( attr ); } - } - //update duration from hit if present: - if( this.durationHint ) - this.duration = this.durationHint; + } if ( $j(element).attr('type')) @@ -430,7 +428,8 @@ mediaSource.prototype = return this.index; }, /* - * function getDuration in milliseconds + * function parseURLDuration + * getDuration in milliseconds * special case derive duration from request url * supports media_url?t=ntp_start/ntp_end url request format */ @@ -460,9 +459,9 @@ mediaSource.prototype = //js_log('f:parseURLDuration() for:' + this.src + ' d:' + this.duration); }, /** Attempts to detect the type of a media file based on the URI. - @param {String} uri URI of the media file. - @returns The guessed MIME type of the file. - @type String + * @param {String} uri URI of the media file. + * @returns The guessed MIME type of the file. + * @type String */ detectType:function(uri) { @@ -473,10 +472,22 @@ mediaSource.prototype = var end_inx = (uri.indexOf('?')!=-1)? uri.indexOf('?') : uri.length; var no_param_uri = uri.substr(0, end_inx); switch( no_param_uri.substr(no_param_uri.lastIndexOf('.'),4).toLowerCase() ){ - case '.flv':return 'video/x-flv';break; - case '.ogg': case '.ogv': return 'video/ogg';break; - case '.oga': return 'audio/ogg'; break; - case '.anx':return 'video/ogg';break; + case '.mp4': + return 'video/h264'; + break; + case '.flv': + return 'video/x-flv'; + break; + case '.ogg': + case '.ogv': + return 'video/ogg'; + break; + case '.oga': + return 'audio/ogg'; + break; + case '.anx': + return 'video/ogg'; + break; } } }; @@ -488,7 +499,7 @@ mediaSource.prototype = @param {element} video_element